package com.bwie.product.service.impl;

import com.bwie.common.domain.Coupon;
import com.bwie.common.domain.Product;
import com.bwie.common.domain.request.ProductRequest;
import com.bwie.common.domain.request.ShopRequset;
import com.bwie.product.mapper.ProductMapper;
import com.bwie.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;

    /**
     * 商品列表
     * @param
     * @return
     */
    @Override
    public List<ProductRequest> showAll() {
        return productMapper.showAll();
    }

    @Override
    public Integer shopAttention(Integer productId) {
        productMapper.shopAttention(productId);
        return productId;
    }

    @Override
    public void updPack(int randomNumber, Integer userId) {
        productMapper.updPack(randomNumber,userId);
    }

    @Override
    public List<Product> findId(Integer productId) {
        return productMapper.findId(productId);
    }

    @Override
    public Integer addCar(ShopRequset shopRequset) {
        return productMapper.addCar(shopRequset);
    }

    @Override
    public Integer addCoupon(Coupon coupon) {
        productMapper.addCoupon(coupon);
        return null;
    }

    @Override
    public void minusCoupon(Integer systemId, Integer systemNum, int count) {
        productMapper.minusCoupon(systemId,systemNum,count);
    }
}
